﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace Vit.Web.DataAnnotations
{
    public class RangeModelValidator : DataAnnotationsModelValidator<RangeAttribute>
    {
        public RangeModelValidator(ModelMetadata metadata, ControllerContext context, RangeAttribute attribute)
            : base(metadata, context, attribute)
        {
        }


        public override IEnumerable<ModelClientValidationRule> GetClientValidationRules()
        {
            return new ModelClientValidationRule[] 
            { 
                new ModelClientValidationRangeRule(base.ErrorMessage, base.Attribute.Minimum, base.Attribute.Maximum) 
            };
        }   
    }
}
